
<template tag="以下文档内容为hycli自动生成">
  <div>
  <el-dialog
    v-model="conf.visible"
    :title="title"
    draggable
    align-center="true"
    width="68%"
    :close-on-click-modal="false"

  >
    <el-tabs v-model="conf.selected">
      <el-tab-pane label="详情" name="aaayy">
<el-row :gutter="24" style="font-size: 0.7rem;">
  <el-col :span="4" class="text-right" style="min-height:26px">编号:</el-col>
  <el-col :span="8" v-text="view.staff_id||'-'" style="min-height:26px" ></el-col>
  <el-col :span="4" class="text-right" style="min-height:26px">名称:</el-col>
  <el-col :span="8" v-text="view.name||'-'" style="min-height:26px" ></el-col>
  <el-col :span="4" class="text-right" style="min-height:26px">部门:</el-col>
  <el-col :span="8" v-text="view.dpt_id_label" style="min-height:26px" :class="$js.page.colorful(view.dpt_id,'dpt_id')" ></el-col>
  <el-col :span="4" class="text-right" style="min-height:26px">业务线:</el-col>
  <el-col :span="8" v-text="view.lob_id_label" style="min-height:26px" :class="$js.page.colorful(view.lob_id,'lob_id')" ></el-col>
  <el-col :span="4" class="text-right" style="min-height:26px">岗位:</el-col>
  <el-col :span="8" v-text="view.position_label" style="min-height:26px" :class="$js.page.colorful(view.position,'position')" ></el-col>
  <el-col :span="4" class="text-right" style="min-height:26px">职位:</el-col>
  <el-col :span="8" v-text="view.title_label" style="min-height:26px" :class="$js.page.colorful(view.title,'title')" ></el-col>
  <el-col :span="4" class="text-right" style="min-height:26px">手机:</el-col>
  <el-col :span="8" v-text="view.mobile||'-'" style="min-height:26px" ></el-col>
  <el-col :span="4" class="text-right" style="min-height:26px">邮箱:</el-col>
  <el-col :span="8" v-text="view.email||'-'" style="min-height:26px" ></el-col>
  <el-col :span="4" class="text-right" style="min-height:26px">邮件通知:</el-col>
  <el-col :span="8" v-text="view.is_email_enabled_label" style="min-height:26px" ></el-col>
  <el-col :span="4" class="text-right" style="min-height:26px">状态:</el-col>
  <el-col :span="8" v-text="view.status_label" style="min-height:26px" :class="$js.page.colorful(view.status,'status')" ></el-col>
  <el-col :span="4" class="text-right" style="min-height:26px">创建时间:</el-col>
  <el-col :span="8" v-text="view.create_time||'-'" style="min-height:26px" ></el-col>
</el-row>
      </el-tab-pane>
        <el-tab-pane label="登录账户" name="aaayx"  @tab-click="show_view_aaayx">
<div class="list">
    <el-table :data="dataList_aaayx"
    
    v-loading="conf.loading" stripe 
        style="width: 100%;height:300px" 
         empty-text="无数据">le
<el-table-column width="24px" type="expand">
    <template #default="view">
        <el-row :gutter="24">
            <el-col :span="5" class="text-right" style="min-height:26px">用户编号:</el-col>
            <el-col :span="7" v-text="view.row.le_user_id" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">员工:</el-col>
            <el-col :span="7" v-text="view.row.staff_id_label" style="min-height:26px"
              ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">姓名:</el-col>
            <el-col :span="7" v-text="view.row.le_name" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">登录名:</el-col>
            <el-col :span="7" v-text="view.row.le_user_name" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">手机号:</el-col>
            <el-col :span="7" v-text="view.row.le_mobile" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">代理人:</el-col>
            <el-col :span="7" v-text="view.row.le_tenant_id" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">微信openid:</el-col>
            <el-col :span="7" v-text="view.row.le_wx_openid" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">状态:</el-col>
            <el-col :span="7" v-text="view.row.status_label" style="min-height:26px"
              ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">最近登录:</el-col>
            <el-col :span="7" v-text="view.row.le_last_login_time" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">最大错误次数:</el-col>
            <el-col :span="7" v-text="view.row.le_max_failed_cnt" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">当前错误次数:</el-col>
            <el-col :span="7" v-text="view.row.le_curr_failed_cnt" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">最近登录失败时间:</el-col>
            <el-col :span="7" v-text="view.row.le_last_failed_time" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">扩展参数:</el-col>
            <el-col :span="7" v-html="view.row.le_ext_params||'-'" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">创建时间:</el-col>
            <el-col :span="7" v-text="view.row.le_create_time" style="min-height:26px" ></el-col>
        </el-row>
    </template>
</el-table-column>
        
        	<!--user_id text -->
        <el-table-column  show-overflow-tooltip    align="center" label="用户编号" >
            <template #default="scope">
                  <span>{{ scope.row.user_id||'-' }}</span>
              </template>
        </el-table-column>
        	<!--name text -->
        <el-table-column  show-overflow-tooltip    align="center" label="姓名" >
            <template #default="scope">
                  <span>{{ scope.row.name||'-' }}</span>
              </template>
        </el-table-column>
        	<!--user_name text -->
        <el-table-column  show-overflow-tooltip    align="center" label="登录名" >
            <template #default="scope">
                  <span>{{ scope.row.user_name||'-' }}</span>
              </template>
        </el-table-column>
        	<!--mobile text -->
        <el-table-column  show-overflow-tooltip    align="center" label="手机号" >
            <template #default="scope">
                  <span>{{ scope.row.mobile||'-' }}</span>
              </template>
        </el-table-column>
        	<!--status switch -->
        <el-table-column     align="center" label="状态">
            <template #default="scope">
                <el-switch  disabled   v-model="scope.row.status_switch" />
            </template>
        </el-table-column>
        	<!--last_login_time date -->
        <el-table-column  show-overflow-tooltip    align="center" label="最近登录" >
            <template #default="scope">
                  <span>{{ scope.row.last_login_time||'-' }}</span>
              </template>
        </el-table-column>
        	<!--create_time date -->
        <el-table-column  show-overflow-tooltip    align="center" label="创建时间" >
            <template #default="scope">
                  <span>{{ scope.row.create_time||'-' }}</span>
              </template>
        </el-table-column>
    </el-table>
</div>
         </el-tab-pane>
    </el-tabs>
    <template #footer>
      <span style="height: 60px"> </span>
    </template>
  </el-dialog>
</div>
</template>
<script>
import gantt from "@/views/cmpnts/gantt.vue"
export default {
   components: {
    gantt,
  },
  data() {
    return {
        conf:{
        visible:false,
        
        selected:"aaayy",
      },
      title:"员工信息详情",
      form:{},
        form_aaayx: {
            pi: 1,
            ps: 15,
            disabled:false,
            single_date_range_name:"",
            single_date_range_value:[],
            single_text_name:"",
            single_text_value:"",
            staff_id:"",
            name:"",
            user_name:"",
            mobile:"",
            },
            staff_idList:[],
            statusList:[],
            dataList_aaayx:[],
            multiQueryDateRange:[],
            multiQueryText:[{label:"姓名",value:"name"},{label:"登录名",value:"user_name"},{label:"手机号",value:"mobile"},],
            total_aaayx:0,
            note_dataList:[],
      view: {
        staff_id:"",
        name:"",
        dpt_id:"",
        lob_id:"",
        position:"",
        title:"",
        mobile:"",
        email:"",
        is_email_enabled:"",
        status:"",
        create_time:"",
        },
      }
  },
  methods: {
  show_cmpnt_aaayv(fm = {}){
    let form = Object.assign({},this.form)
    form = Object.assign(form,fm)
    form.is_email_enabled = "1"
    form.status = "0"
    this.$refs.cmpnt_aaayv.show(form)
  },
  show_cmpnt_aaayt(fm = {}){
    let form = Object.assign({},this.form)
    form = Object.assign(form,fm)
    this.$refs.cmpnt_aaayt.show(form)
  },
  show_cmpnt_aaayu(fm = {}){
    let form = Object.assign({},this.form)
    form = Object.assign(form,fm)
    this.$refs.cmpnt_aaayu.show(form)
  },
  show_cmpnt_aaayw(fm = {}){
    let form = Object.assign({},this.form)
    form = Object.assign(form,fm)
    form.staff_id = (this.bcheck||[]).join(",")
    this.$refs.cmpnt_aaayw.show_aaayw(form)
  },
 show(form) {
    this.conf.visible = true
    this.form = form
    //登录账户查询
    let nform_aaayx = {}
    this.queryData_aaayx(form,nform_aaayx)
   let that = this;
   this.$theia.http
      .get("/ws/staff/info",form)
      .then((res) => {
        let item = Object.assign({}, res)
        item.dpt_id_label = that.$theia.enum.getName("department_info",item.dpt_id)
        item.lob_id_label = that.$theia.enum.getName("my_business_line",item.lob_id)
        item.position_label = that.$theia.enum.getName("position",item.position)
        item.title_label = that.$theia.enum.getName("title",item.title)
        item.is_email_enabled_label = that.$theia.enum.getName("bool",item.is_email_enabled)
        item.status_label = that.$theia.enum.getName("status",item.status)
        item.create_time = that.$theia.str.dateFormat(item.create_time,'yyyy-MM-dd')
        that.view = item
      })
      .catch((res) => {
        let code = res.response.status;
        let msg = `员工信息查询失败(${code})`;
        that.$notify.error({ title: "失败", message: msg, duration: 5000 });
      });
  },

queryData_aaayx(mform = {},nform={}){
    //构建查询参数
    let queryForm = Object.assign({},this.form_aaayx)
    queryForm = Object.assign(queryForm,nform||{})
    
    //处理多个日期选择
    queryForm[this.form_aaayx.single_date_range_name] = this.form_aaayx.single_date_range_value
    queryForm[this.form_aaayx.single_text_name] = this.form_aaayx.single_text_value
   
    //处理日期范围选择

    queryForm[this.form_aaayx.single_date_range_name] = null
    queryForm.single_date_range_value = null
    queryForm.single_date_range_name = null

    queryForm.single_text_value = null
    queryForm.single_text_name = null
 
    //处理关联表user_account staff_info user_account
    queryForm.staff_id = mform.staff_id
   
    //发送查询请求
    let that = this
    that.conf.loading = true
    queryForm.ps = 100
    //构建统计查询
  //数据查询
  this.$theia.http.get("/sso/user/account/query",queryForm).then(res=>{
      if((res.items||[]).length < (queryForm.ps||10)){
        that.form_aaayx.disabled = true
      }
      that.conf.loading = false
      that.dataList_aaayx = res.items||[]
      that.total_aaayx = res.count
      that.resetItemData_aaayx(that,that.dataList_aaayx)
    });
  },

  resetItemData_aaayx(that,lst){
    lst.forEach(item => {
      item.__raw = Object.assign({}, item)
    item.staff_id_label = that.$theia.enum.getName("staff_info",item.staff_id)
    item.status_label = that.$theia.enum.getName("status",item.status)
    item.user_id_progress = item.user_id
    item.staff_id_progress = item.staff_id
    item.name_progress = item.name
    item.user_name_progress = item.user_name
    item.mobile_progress = item.mobile
    item.tenant_id_progress = item.tenant_id
    item.wx_openid_progress = item.wx_openid
    item.status_switch = item.status == 0
    item.last_login_time_progress = item.last_login_time
    item.max_failed_cnt_progress = item.max_failed_cnt
    item.curr_failed_cnt_progress = item.curr_failed_cnt
    item.last_failed_time_progress = item.last_failed_time
    item.ext_params_progress = item.ext_params
    item.create_time_progress = item.create_time
    item.le_user_id = item.user_id
    item.le_staff_id = item.staff_id
    item.le_name = item.name
    item.le_user_name = item.user_name
    item.le_mobile = item.mobile
    item.le_tenant_id = item.tenant_id
    item.le_wx_openid = item.wx_openid
    item.le_status = item.status
    item.le_last_login_time = that.$theia.str.dateFormat(item.last_login_time,'MM/dd HH:mm')
    item.le_max_failed_cnt = item.max_failed_cnt
    item.le_curr_failed_cnt = item.curr_failed_cnt
    item.le_last_failed_time = that.$theia.str.dateFormat(item.last_failed_time,'MM/dd HH:mm')
    item.le_ext_params = item.ext_params
    item.le_create_time = that.$theia.str.dateFormat(item.create_time,'MM/dd')
    item.last_login_time = that.$theia.str.dateFormat(item.last_login_time,'MM/dd HH:mm')
    item.create_time = that.$theia.str.dateFormat(item.create_time,'MM/dd')
    if(item.children){
      that.resetItemData_aaayx(that,item.children)
    }
  });
  },
  onstatusSwitchChange(xfrom,v) {
      let form = {}
      form.status = v == true? 0 : 1;
      form.user_id = xfrom.user_id
      let that = this
      this.$theia.http.post("/sso/user/account/switch",form).then(res=>{
        that.$notify.success({title: '成功',message: '修改状态成功',duration:5000})
      }).catch(res=>{
        v = !v
        let code = ((res||{}).response||{}).status||0
        let msg = `修改状态失败(${code})`
        that.$notify.error({title: '失败',message: msg,duration:5000})
      });
  }, 
    onChange_staff_id(val){
      this.staff_idList = this.$theia.enum.get("staff_info",val)
      this.form_aaayx.staff_id = null
    },
    loadEnums_aaayx(){
        //员工
        this.staff_idList = this.$theia.enum.get("staff_info","","" ,false,"")
        //状态
        this.statusList = this.$theia.enum.get("status","","" ,false,"")
    },

  },
};
</script>
<style scoped>
/deep/.el-step__title{
    font-size: 0.8rem;
}
.steps{
  margin-top:8px;
  margin-bottom:  16px;
}
</style>